package com.atmc.service.impl;

import com.atmc.entity.ResponseResult;
import com.atmc.entity.WishForm;
import com.atmc.mapper.WishFormMapper;
import com.atmc.service.WishFormService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @BelongsProject: SpringCloud1216
 * @BelongsPackage: com.atmc.service.impl
 * @Author: chuyings
 * @CreateTime: 2022-11-17  13:44
 * @Version: 1.0
 */
@Service
public class WishFormServiceImpl implements WishFormService {
    @Autowired
    WishFormMapper wishFormMapper;
    @Override
    public List<WishForm> queryByUserName(String userName) {
        return wishFormMapper.queryByUserName(userName);
    }

    @Override
    public int insertOneWishForm(WishForm wishForm) {
        return wishFormMapper.insertOneWishForm(wishForm);
    }

    @Override
    public ResponseResult commitWishForm(WishForm wishForm) {
        wishFormMapper.insertOneWishForm(wishForm);
        return new ResponseResult(200,"提交成功");
    }

    @Override
    public List<WishForm> getPetAdoptionRecord(WishForm wishForm) {
        return wishFormMapper.queryByUserName(wishForm.getUserName());
    }
}
